package catwork::Model::Helper;
use Moose;
use namespace::autoclean;

use File::Find;
use Template;

extends 'Catalyst::Model';

=head1 NAME

catwork::Model::Helper - Catalyst Model

=head1 DESCRIPTION

Catalyst Model.

=head2 MakeStatic

=cut
my @files;

sub MakeStatic
{
    my ($self, $c) = @_;

    @files = ();
    File::Find::find(\&_wanted, (".$c->{PATH_STATIC_SRC}"));

    my $tt = Template->new(RELATIVE => 1) || die Template->error(), "\n";
    for my $file (@files) {
        $tt->process($file, $c, "/tmp/tt/$file") || die $tt->error(), "\n";
    }
}

sub _wanted
{
   return unless $File::Find::name =~ /\.(js|css)$/;
   push @files, $File::Find::name;
}


=head1 AUTHOR

A clever guy

=head1 LICENSE

This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

__PACKAGE__->meta->make_immutable;

1;
